package objectCase;

public class RoleTest {
    public static void main(String[] args) {
        Role r1 = new Role("张三",100);
        Role r2 = new Role("李四",100);
        for (int i = 0;true; i++) {
            if(r1.getBlood()>0){
                r1.attack(r2);
            } else {
                System.out.printf("在第 %s 回合，%s被%s击倒\n",i,r1.getName(),r2.getName());
                //System.out.println("在第"+ i + "回合" + r1.getName() + "被" + r2.getName() + "击倒");
                break;
            }
            if(r2.getBlood()>0){
                r2.attack(r1);
            } else {
                System.out.printf("在第 %s 回合，%s被%s击倒\n",i,r2.getName(),r1.getName());
                //System.out.println("在第"+ i + "回合" + r2.getName() + "被" + r1.getName() + "击倒");
                break;
            }
        }

    }
}
